﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PhotoProject.aspx.cs" Inherits="HQWeb.Progect.PhotoManage.PhotoProject" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../Styles/Site.css" rel="Stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="../../My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery-1.7.2.js"></script>
    <!-- Second, add the Timer and Easing plugins -->
    <script type="text/javascript" src="js/jquery.timers-1.2.js"></script>
    <script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
    <!-- Third, add the GalleryView Javascript and CSS files -->
    <script type="text/javascript" src="js/jquery.galleryview-3.0-dev.js"></script>
    <link type="text/css" rel="stylesheet" href="css/jquery.galleryview-3.0-dev.css" />
    <!-- Lastly, call the galleryView() function on your unordered list(s) -->
    <script type="text/javascript">
//        $(function () {
//            Init();
//        });
    </script>
    <script type="text/javascript">
//        function Init() {
//            var titel = document.getElementById("Titel").value;
//            var state = document.getElementById("drop_State").value;
//            var begintime = document.getElementById("d12").value;
//            var endtime = document.getElementById("d13").value;
//            HQWeb.Progect.PhotoManage.PhotoServer.InitPhoto(titel, state, begintime, endtime, branch_id, InitResout, failedCallback);
//        }

        function InitResout(obj) {
             $("#canvas").html('');
             $("#canvas").html('<ul id="myGallery"></ul>');
            var strHtml = "";
//            for (var i in obj) {
//                strHtml = strHtml + "<li><img src=\"" + obj[i].URLOriginal + "\"  /></li>";
            //            }
            strHtml = strHtml + "<li><img src=\"" + obj + "\"  /></li>";
            $("#myGallery").html(strHtml);
            var width = document.body.offsetWidth - 400;
            $("#myGallery").galleryView({ panel_width: width , panel_height:300,show_filmstrip:false});
            $("#canvas").css("margin-left", 200);
            $("#canvas").css("margin-right", 200);
            getFile(); 
        }

        function AddProject() {
            var str = window.showModalDialog("SelectProject/ProjectFrame.htm", " ", "dialogWidth:1000px;dialogHeight:600px;center:yes;help:no;resizable:yes;status:no;");
            if (str != undefined) {
                var projectList = document.getElementById("hidProjectIDList").value;
                if (projectList.indexOf(',' + str.id + ',') >= 0) {
                    alert("添加重复项目！");
                }
                else {
                    if (projectList != null && projectList != "") {
                        document.getElementById("hidProjectIDList").value += str.id + ",";
                    } else {
                        document.getElementById("hidProjectIDList").value = "," + str.id + ",";
                    }
                    var Count = document.getElementById("hidCount").value;
                    var strHtml = "";
                    strHtml = strHtml + '  <table width="98%" id=\"table' + Count + '\">';
                    strHtml = strHtml + " <tr>";
                    strHtml = strHtml + "<td align=\"right\" style=\"width: 20%\">";
                    strHtml = strHtml + " 服务项目名称：";
                    strHtml = strHtml + "  </td><td align=\"left\" style=\"width: 20%\">"
                    strHtml = strHtml + str.name;
                    strHtml = strHtml + " </td><td align=\"right\" style=\"width: 20%\">";
                    strHtml = strHtml + " 价 格：";
                    strHtml = strHtml + " </td><td style=\"width: 20%\" align=\"left\">";
                    strHtml = strHtml + str.price;
                    strHtml = strHtml + "元";
                    strHtml = strHtml + "</td>";
                    strHtml = strHtml + "</tr>";
                    strHtml = strHtml + "<tr>";
                    strHtml = strHtml + " <td align=\"right\" style=\"width: 20%\">";
                    strHtml = strHtml + "说明：";
                    strHtml = strHtml + "</td>";
                    strHtml = strHtml + "<td align=\"left\" colspan=\"3\">";
                    strHtml = strHtml + str.remark;
                    strHtml = strHtml + "</td>";
                    strHtml = strHtml + "</tr>";
                    strHtml = strHtml + "<tr align=\"left\">";
                    strHtml = strHtml + "<td colspan=\"4\">";
                    strHtml = strHtml + "<input type=\"button\" id=\"del" + Count + "\" value=\"删除该项目\"  onclick=\"DeleteNode('table" + Count + "')\"/>";
                    strHtml = strHtml + "</td>";
                    strHtml = strHtml + " </tr>";
                    strHtml = strHtml + "<input type=\"text\" style=\"display: none\" value=\"" + str.id + "\" id=\"p" + Count + "\" />";
                    strHtml = strHtml + " <input type=\"text\" id=\"e" + Count + "\" style=\"display: none\" />";
                    strHtml = strHtml + "<input type=\"text\" style=\"display: none\" value=\"" + str.budget + "\" id=\"b" + Count + "\" />";
                    strHtml = strHtml + "<input type=\"text\" style=\"display: none\" value=\"" + str.type + "\" id=\"t" + Count + "\" />";
                    strHtml = strHtml + " </table>";
                    document.getElementById("hidCount").value = parseInt(Count, 10) + 1;
                    document.getElementById("Addtable").innerHTML = document.getElementById("Addtable").innerHTML + strHtml;
                }
            }
        }

        //JS 删除节点
        function DeleteNode(nodeID) {
            var varType = document.getElementById("hidType").value;
            if (varType == "edit") {
                var varDelID = "e" + nodeID.substr(5);
                varDelID = document.getElementById(varDelID).value;
                HQWeb.Progect.PhotoManage.PhotoServer.DelFileProject(varDelID, DelResout, failedCallback);
            }
            var projectList = document.getElementById("hidProjectIDList").value;
            var projectID = "p" + nodeID.substr(5);
            var projectIDValue = "," + document.getElementById(projectID).value + ",";
            projectList = projectList.replace(projectIDValue, ",");
            document.getElementById("hidProjectIDList").value = projectList;
            var trnode = document.getElementById(nodeID);
            trnode.parentNode.removeChild(trnode);
        }
        //删除回调函数
        function DelResout(resout) {
            if (resout != "") {
                if (resout == "SessionTimeout") {
                    top.location.href = '../../Login/Login.aspx';
                } else {
                    alert(resout);
                }
            }
        }

        //保存事情
        function AddData() {
            var fileid = document.getElementById("hidPid").value;
            document.getElementById("btnAdd").disabled = true;     //不可保存
            var varType = document.getElementById("hidType").value;
            var FileModel = new Object();
            var File_Attribute = new Object();
            FileModel.FILE_ID = fileid;
            File_Attribute.FILE_ID = fileid;
            File_Attribute.AREA = document.getElementById("drop_area").value
            File_Attribute.CELEBRATION_TYPE = document.getElementById("drop_type").value; //获取选择项的值
            File_Attribute.MATERIAL_STAR = document.getElementById("material_star").value; //获取选择项的值
            //获取置顶
//            if (document.getElementById("settop").checked == true) {
//                var date = new Date();
//                FileModel.SETTOPTIME = date.toDateString;
//            }
            if(document.getElementById('xilai_show').checked == true){
            if(FileModel.FILE_FORM != null &&  FileModel.FILE_FORM != ""){
             FileModel.FILE_FORM = FileModel.FILE_FORM + "1,";
             }
             else{
             FileModel.FILE_FORM = "1,";
             }
             var els=document.getElementsByName("qstyle");
             for(var i=0;i<els.length;i++) {
                 if(els[i].tagName.toLowerCase()=="input" && els[i].type=="checkbox" && els[i].checked == true) {
                    var attribute = els[i].getAttribute("value");
                    if(File_Attribute.STYLE != null && File_Attribute.STYLE != ""){
                    File_Attribute.STYLE = File_Attribute.STYLE + attribute + ",";
                    }
                    else{
                        File_Attribute.STYLE = "," + attribute + ",";
                    }
                }
             }
            File_Attribute.COLOR = document.getElementById("drop_color").value; //获取选择项的值
            File_Attribute.WEDDING_PRICE = document.getElementById("drop_price").value; //获取选择项的值
            File_Attribute.WEDDING_MONTH = document.getElementById("wending_month").value; //获取选择项的值
            File_Attribute.DRESS_TYPE = document.getElementById("dress_type").value; //获取选择项的值
            File_Attribute.DRESS_LEVEL = document.getElementById("dress_level").value; //获取选择项的值
            File_Attribute.DRESS_COLOR = document.getElementById("dress_color").value; //获取选择项的值
            File_Attribute.DRESS_PRICE = document.getElementById("drop_dressprice").value; //获取选择项的值
            File_Attribute.HOTEL_NAME = document.getElementById("name_hotel").value;
            }
             if(document.getElementById('new_school').checked == true){
              if(FileModel.FILE_FORM != null &&  FileModel.FILE_FORM != ""){
             FileModel.FILE_FORM = FileModel.FILE_FORM + "2,";
             }
             else{
             FileModel.FILE_FORM = "2,";
             }
                if(document.getElementById('wedding_knowledge').checked == true){
                if(File_Attribute.NEWSCHOOL != null && File_Attribute.NEWSCHOOL != ""){
                File_Attribute.NEWSCHOOL = File_Attribute.NEWSCHOOL + "1,";
                }
                else{
                    File_Attribute.NEWSCHOOL = "1,";
                }
              }
               if(document.getElementById('newer_aq').checked == true){
                if(File_Attribute.NEWSCHOOL != null && File_Attribute.NEWSCHOOL != ""){
                File_Attribute.NEWSCHOOL = File_Attribute.NEWSCHOOL + "2,";
                }
                else{
                    File_Attribute.NEWSCHOOL = "2,";
                }
              }
               if(document.getElementById('local_knowledge').checked == true){
                 if(File_Attribute.NEWSCHOOL != null && File_Attribute.NEWSCHOOL != ""){
                File_Attribute.NEWSCHOOL = File_Attribute.NEWSCHOOL + "3,";
                }
                else{
                    File_Attribute.NEWSCHOOL = "3,";
                }
              }
            }
             if(document.getElementById('wedding_made').checked == true){
            if(FileModel.FILE_FORM != null &&  FileModel.FILE_FORM != ""){
             FileModel.FILE_FORM = FileModel.FILE_FORM + "3,";
             }
             else{
             FileModel.FILE_FORM = "3,";
             }
            File_Attribute.WEDDING_COLOR = document.getElementById("drop_weddingcolor").value; //获取选择项的值 
              var els=document.getElementsByName("wstyle");
             for(var i=0;i<els.length;i++) {
                 if(els[i].tagName.toLowerCase()=="input" && els[i].type=="checkbox" && els[i].checked == true) {
                    var attribute = els[i].getAttribute("value");
                    if(File_Attribute.WEDDING_STYLE != null && File_Attribute.WEDDING_STYLE != ""){
                    File_Attribute.WEDDING_STYLE = File_Attribute.WEDDING_STYLE + attribute + ",";
                    }
                    else{
                        File_Attribute.WEDDING_STYLE = "," + attribute + ",";
                    }
                }
             }
            }
             if(document.getElementById('hotel_info').checked == true){
           if(FileModel.FILE_FORM != null &&  FileModel.FILE_FORM != ""){
             FileModel.FILE_FORM = FileModel.FILE_FORM + "4,";
             }
             else{
             FileModel.FILE_FORM = "4,";
             }
            File_Attribute.HOTEL_DESK_NUM = document.getElementById("drop_desknum").value; //获取选择项的值
            File_Attribute.HOTEL_SPECIFICATION = document.getElementById("hotel_specification").value; //获取选择项的值
            File_Attribute.HOTEL_LOCATION = document.getElementById("hotel_location").value;
              var els=document.getElementsByName("jstyle");
             for(var i=0;i<els.length;i++) {
                 if(els[i].tagName.toLowerCase()=="input" && els[i].type=="checkbox" && els[i].checked == true) {
                    var attribute = els[i].getAttribute("value");
                    if(File_Attribute.HOTEL_STYLE != null && File_Attribute.HOTEL_STYLE != ""){
                    File_Attribute.HOTEL_STYLE = File_Attribute.HOTEL_STYLE + attribute + ",";
                    }
                    else{
                        File_Attribute.HOTEL_STYLE = "," + attribute + ",";
                    }
                }
             }
            }
             if(document.getElementById('my_xilai').checked == true){
             if(FileModel.FILE_FORM != null &&  FileModel.FILE_FORM != ""){
             FileModel.FILE_FORM = FileModel.FILE_FORM + "5,";
             }
             else{
             FileModel.FILE_FORM = "5,";
             }
            if(document.getElementById('card_function').checked == true){
                if(File_Attribute.MYXILAI != null && File_Attribute.MYXILAI != "")
                {
                File_Attribute.MYXILAI = File_Attribute.MYXILAI + "1,";
                }
                else{
                    File_Attribute.MYXILAI = "1,";
                }
              }
               if(document.getElementById('resource_type').checked == true){
                 if(File_Attribute.MYXILAI != null && File_Attribute.MYXILAI != "")
                {
                File_Attribute.MYXILAI = File_Attribute.MYXILAI + "2,";
                }
                else{
                    File_Attribute.MYXILAI = "2,";
                }
              }
            }
        FileModel.REAMRK = document.getElementById("file_remark").value;
//        FileModel.PROJECTREAMRK = document.getElementById("project_remark").value;
        FileModel.FILE_TITEL = document.getElementById("filename").value;
        if (document.getElementById('wedding_made').checked == true) {
            var info = GeArrList(varType);
            if (info[0] == "") {
                File_Attribute.MAX_PRICE = document.getElementById("hidProjectMaxPrice").value;
                File_Attribute.MIN_PRICE = document.getElementById("hidProjectMinPrice").value;
                File_Attribute.PROJECT_TYPE = document.getElementById("hidProjectType").value;
                if (document.getElementById("hidProject") == "projectedit") {
                    HQWeb.Progect.PhotoManage.PhotoServer.EditProject(FileModel, File_Attribute, info[1], SaveResout, failedCallback);
                } else {
                    if (varType == "edit") {
                        HQWeb.Progect.PhotoManage.PhotoServer.EditProject(FileModel, File_Attribute, info[1], SaveResout, failedCallback);
                    } else {
                        HQWeb.Progect.PhotoManage.PhotoServer.AddProject(FileModel, File_Attribute, info[1], SaveResout, failedCallback);
                    }
                }
            }
            else {
                if (varType == "edit") {
                    HQWeb.Progect.PhotoManage.PhotoServer.Edit(FileModel, File_Attribute, SaveResout, failedCallback);
                } else {
                    HQWeb.Progect.PhotoManage.PhotoServer.Add(FileModel, File_Attribute, SaveResout, failedCallback);
                }
            }
        }
        else {
            if (varType == "edit") {
                HQWeb.Progect.PhotoManage.PhotoServer.Edit(FileModel, File_Attribute, SaveResout, failedCallback);
            } else {
                HQWeb.Progect.PhotoManage.PhotoServer.Add(FileModel, File_Attribute, SaveResout, failedCallback);
            }
        }
        document.getElementById("btnAdd").disabled = true;     //可保存
    }

        //保存返回结果
        function SaveResout(resout) {
            if (resout == "") {
                alert("保存成功！");
                document.getElementById("btnAdd").value = "编 辑"
                document.getElementById("btnAdd").disabled = false;
                getFile();
            } else {
                if (resout == "SessionTimeout") {
                    top.location.href = '../../Login/Login.aspx';
            } else {
                alert(resout);
            }
            }
        }
        //获得项目事件
        function GeArrList(type) {
            var objArry = new Array();
            var strType;
            var maxprice;
            var minprice;
            var Count = document.getElementById("hidCount").value;
            var varPID = document.getElementById("hidPid").value;
            for (var i = 0; i < Count; i++) {
                var idTemp = "p" + i;
                var inputTpem = document.getElementById(idTemp);
                if (inputTpem != null) {
                    var obj = new Object();
                    obj.FILE_ID = varPID;
                    if (inputTpem.value == "") {
                        var alter = "项目种类必选！";
                        return [alter, null];
                    } else {
                        obj.PROJECT_ID = inputTpem.value;
                        idTemp = "b" + i;
                        inputTpem = document.getElementById(idTemp);
                        maxprice = document.getElementById("hidProjectMaxPrice");
                        if(maxprice.value != ""){
                         if(inputTpem != null && inputTpem.value > maxprice.value){
                            document.getElementById("hidProjectMaxPrice").value = inputTpem.value;
                         }
                        } else {
                            if(inputTpem != null && inputTpem.value != null){
                             document.getElementById("hidProjectMaxPrice").value = inputTpem.value;
                            }
                        }
                        minprice = document.getElementById("hidProjectMinPrice");
                         if(minprice.value != ""){
                            if(inputTpem != null && inputTpem.value < minprice.value){
                                document.getElementById("hidProjectMinPrice").value = inputTpem.value;
                            }
                          } else {
                             if(inputTpem != null &&  inputTpem.value != null){
                             document.getElementById("hidProjectMinPrice").value = inputTpem.value;
                            }
                        }
                        idTemp = "t" + i;
                        inputTpem = document.getElementById(idTemp);
                        if(inputTpem != null){
                            if(strType != null && strType != "" && strType != undefined){
                            strType += inputTpem.value + ",";
                            }
                            else {
                            strType = "," + inputTpem.value + ",";
                            }
                        }
                        if (document.getElementById("hidProject").value == "projectedit") {
                            idTemp = "e" + i;
                            if (document.getElementById(idTemp).value != "") {
                                obj.ID = document.getElementById(idTemp).value;
                            } else {
                                obj.ID = 0;
                            }
                        }
                    }
                    document.getElementById("hidProjectType").value = strType
                    objArry.push(obj);
                }
            }
            return ["", objArry]
        }

        //获得文件信息
        function getFile() {
            var strID = document.getElementById("hidPid").value;
            clearSelect();
            document.getElementById("drop_area").value = "0";
            document.getElementById("drop_type").value = "0";
             document.getElementById("btnAdd").disabled = false;
             HQWeb.Progect.PhotoManage.PhotoServer.GetFile(strID, GetResout, failedCallback);
         }

         function getOtherFile() {
             clearSelect();
             var strID = document.getElementById("hidOtherPid").value;
             document.getElementById("drop_area").value = "0";
             document.getElementById("drop_type").value = "0";
             if (strID != "") {
                 HQWeb.Progect.PhotoManage.PhotoServer.GetFile(strID, GetOtherResout, failedCallback);
             }
         }

         function GetOtherResout(obj) {
             if (obj != null) {
                 if (obj.ISFLAG) {
                     var fileform = obj.FILE_FORM;
                     if (fileform != null) {
                         var form = new Array();
                         form = fileform.split(',');
                         for (var i in form) {
                             switch (form[i]) {
                                 case "1": document.getElementById('xilai_show').checked = true; checkchange('xilai_show', 'show', 'img_show'); break;
                                 case "2": document.getElementById('new_school').checked = true; checkchange('new_school', 'school', 'img_school'); break;
                                 case "3": document.getElementById('wedding_made').checked = true; checkchange('wedding_made', 'made', 'img_made'); break;
                                 case "4": document.getElementById('hotel_info').checked = true; checkchange('hotel_info', 'hotel', 'img_hotel'); break;
                                 case "5": document.getElementById('my_xilai').checked = true; checkchange('my_xilai', 'xilai', 'img_xilai'); break;
                                 default: break;
                             }
                         }
                     }
                     var strID = document.getElementById("hidOtherPid").value;
                     HQWeb.Progect.PhotoManage.PhotoServer.FileAttribute(strID, SetFileAttribute, failedCallback);
                     if (fileform.indexOf('3,') >= 0) {
                         //document.getElementById("getFile_Project").click();
                         HQWeb.Progect.PhotoManage.PhotoServer.FileProject(strID, SetFileProject, failedCallback);
                     }
                 }
             }
         }


        function GetResout(obj) {
            if (obj != null) {
                document.getElementById("file_remark").value = "";
//                document.getElementById("project_remark").value = obj.PROJECTREAMRK;
                document.getElementById("filename").value = obj.FILE_TITEL;
                var datetime = new Date(obj.UPTIME.toString());
                document.getElementById("upUserName").innerText = obj.USERNAME;
                document.getElementById("updatetime").innerText = datetime.toLocaleDateString();
                var fileform = obj.FILE_FORM;
                if (fileform != null) {
                    var form = new Array();
                    form = fileform.split(',');
                    for (var i in form) {
                        switch (form[i]) {
                            case "1": document.getElementById('xilai_show').checked = true; checkchange('xilai_show', 'show', 'img_show'); break;
                            case "2": document.getElementById('new_school').checked = true; checkchange('new_school', 'school', 'img_school'); break;
                            case "3": document.getElementById('wedding_made').checked = true; checkchange('wedding_made', 'made', 'img_made'); break;
                            case "4": document.getElementById('hotel_info').checked = true; checkchange('hotel_info', 'hotel', 'img_hotel'); break;
                            case "5": document.getElementById('my_xilai').checked = true; checkchange('my_xilai', 'xilai', 'img_xilai'); break;
                            default: break;
                        }
                    }
                }
                if (obj.ISFLAG) {
                    if (obj.REAMRK != null && obj.REAMRK != "") {
                        document.getElementById("file_remark").value = obj.REAMRK;
                    }
                    document.getElementById("hidType").value = "edit";
                    document.getElementById("btnAdd").value = "编 辑";
                    var strID = document.getElementById("hidPid").value;
                    HQWeb.Progect.PhotoManage.PhotoServer.FileAttribute(strID, SetFileAttribute, failedCallback);
                    if (fileform.indexOf('3,') >= 0) {
                        //document.getElementById("getFile_Project").click();
                        HQWeb.Progect.PhotoManage.PhotoServer.FileProject(strID, SetFileProject, failedCallback);
                    }
                }
                else {
                    getOtherFile();
                }
            }
        }

        //设定文件项目
        function SetFileProject(obj){
         var lenght = obj.indexOf("@");
         var count = obj.substring(0, lenght);
         var strprojecthtml = obj.substring(lenght + 1);
         lenght = strprojecthtml.indexOf("@");
         document.getElementById("hidProjectIDList").value = strprojecthtml.substring(0, lenght);
         var strhtml = strprojecthtml.substring(lenght + 1);
         if(count != "0")
          {
           document.getElementById("hidCount").value = count;
           document.getElementById("hidProject").value = "projectedit";
          } 
          document.getElementById("Addtable").innerHTML = strhtml;
        }

        //设置文件属性
        function SetFileAttribute(obj) {
        if(obj != null){
            if(obj.HOTEL_NAME != null && obj.HOTEL_NAME != ""){
             document.getElementById("name_hotel").value = obj.HOTEL_NAME;
            }
            //var dropTemp;
            if(obj.AREA != null && obj.AREA != ""){
               document.getElementById("drop_area").value = obj.AREA;  
            }
             if(obj.CELEBRATION_TYPE != null && obj.CELEBRATION_TYPE != ""){
                document.getElementById("drop_type").value = obj.CELEBRATION_TYPE;
            }
             if(obj.COLOR != null && obj.COLOR != ""){
                 document.getElementById("drop_color").value = obj.COLOR;
            }
             if(obj.WEDDING_PRICE != null && obj.WEDDING_PRICE != ""){
              document.getElementById("drop_price").value = obj.WEDDING_PRICE;  
            }
            if(obj.WEDDING_MONTH != null && obj.WEDDING_MONTH != ""){
                document.getElementById("wending_month").value = obj.WEDDING_MONTH;
           }
             if(obj.DRESS_TYPE != null && obj.DRESS_TYPE != ""){
                document.getElementById("dress_type").value = obj.DRESS_TYPE;
            }
             if(obj.DRESS_LEVEL != null && obj.DRESS_LEVEL != ""){
                 document.getElementById("dress_level").value = obj.DRESS_LEVEL;
            }
             if(obj.DRESS_COLOR != null && obj.DRESS_COLOR != ""){
                document.getElementById("dress_color").value = obj.DRESS_COLOR;
            }
             if(obj.DRESS_PRICE != null && obj.DRESS_PRICE != ""){
                document.getElementById("drop_dressprice").value = obj.DRESS_PRICE;
            }
             if(obj.WEDDING_COLOR != null && obj.WEDDING_COLOR != ""){
                document.getElementById("drop_weddingcolor").value = obj.WEDDING_COLOR;
            }
             if(obj.MATERIAL_STAR != null && obj.MATERIAL_STAR != ""){
                document.getElementById("material_star").value = obj.MATERIAL_STAR;
            }
             if(obj.HOTEL_DESK_NUM != null && obj.HOTEL_DESK_NUM != ""){
                document.getElementById("drop_desknum").value = obj.HOTEL_DESK_NUM;
            }
             if(obj.HOTEL_SPECIFICATION != null && obj.HOTEL_SPECIFICATION != ""){
                document.getElementById("hotel_specification").value = obj.HOTEL_SPECIFICATION;
            }
            if(obj.HOTEL_LOCATION != null && obj.HOTEL_LOCATION != ""){
                document.getElementById("hotel_location").value = obj.HOTEL_LOCATION;
            }
            if(obj.PROJECT_TYPE != null && obj.PROJECT_TYPE != ""){
            document.getElementById("hidProjectType").value = obj.PROJECT_TYPE;
            }
            if(obj.MAX_PRICE != null && obj.MAX_PRICE != ""){
            document.getElementById("hidProjectMaxPrice").value = obj.MAX_PRICE;
            }
             if(obj.MIN_PRICE != null && obj.MIN_PRICE != ""){
            document.getElementById("hidProjectMinPrice").value = obj.MIN_PRICE;
            }
            if(obj.NEWSCHOOL != null){
                 var newerschool = obj.NEWSCHOOL;
                 var newschool = new Array();
                 newschool = newerschool.split(',');
                for(var i in newschool){
                    switch(newschool[i]){
                    case "1": document.getElementById('wedding_knowledge').checked = true;break;
                    case "2": document.getElementById('newer_aq').checked = true;break;
                    case "3": document.getElementById('local_knowledge').checked = true;break;
                    default:break;
                }
            }
            }
            if(obj.MYXILAI != null)
            {
            newerschool = obj.MYXILAI;
            var myxilai = new Array();
            myxilai = newerschool.split(',');
            for(var i in myxilai){
                 switch(myxilai[i]){
                case "1": document.getElementById('card_function').checked = true;break;
                case "2": document.getElementById('resource_type').checked = true;break;
                default:break;
            }
            }
            }
            if(obj.STYLE != null && obj.STYLE != ""){
            newerschool = obj.STYLE;//初始化风格
            newschool = newerschool.split(',');
            for(var i in newschool){
            var checkstyle = "q" + newschool[i];
            var style = document.getElementById(checkstyle);
            if(style != null){
            style.checked = true;
            }
            }
            }
            if(obj.WEDDING_STYLE != null && obj.WEDDING_STYLE != "")
            {
            newerschool = obj.WEDDING_STYLE;//初始化婚礼风格
            newschool = newerschool.split(',');
            for(var i in newschool){
            var checkstyle = "w" + newschool[i];
            var style = document.getElementById(checkstyle);
            if(style != null){
            style.checked = true;
            }
            }
            }
            if(obj.HOTEL_STYLE !=null && obj.HOTEL_STYLE !="")
            { 
            newerschool = obj.HOTEL_STYLE;//初始化酒店风格
            newschool = newerschool.split(',');
            for(var i in newschool){
            var checkstyle = "j" + newschool[i]
             var style = document.getElementById(checkstyle);
              if(style != null){
            style.checked = true;
            }
            }
            }
        }
        }

        //客户端异常处理
        function failedCallback(error) {
            alert(error.get_message());
        }

        //缩放功能
        function expandcollapse(obj, row) {
            var div = document.getElementById(obj);
            var img = document.getElementById(row);

            if (div.style.display == "none") {
                div.style.display = "";
                img.src = "../../Images/collapse_blue.jpg";
                img.alt = "关闭显示";
            }
            else {
                div.style.display = "none";
                img.src = "../../Images/expand_blue.jpg";
                img.alt = "显示下级菜单";
            }
        }
        
        function checkchange(checkbox, obj, row) {
            var check = document.getElementById(checkbox);
            var div = document.getElementById(obj);
            var img = document.getElementById(row);
            if (check.checked) {
                if (checkbox == 'xilai_show') {
                    var cdiv = document.getElementById('dress');
                    var cimg = document.getElementById('img_dress');
                    cdiv.style.display = "";
                    cimg.src = "../../Images/collapse_blue.jpg";
                    cimg.alt = "关闭显示";
                }
                if(checkbox == 'wedding_made'){
                add.style.display = "";
                //add.style.display = " ";
                }
                div.style.display = "";
                img.src = "../../Images/collapse_blue.jpg";
                img.alt = "关闭显示";
            }
            else {
                if (checkbox == 'xilai_show') {
                    var cdiv = document.getElementById('dress');
                    var cimg = document.getElementById('img_dress');
                    cdiv.style.display = "none";
                    cimg.src = "../../Images/expand_blue.jpg";
                    cimg.alt = "显示下级菜单";
                }
               if(checkbox == 'wedding_made'){
                 add.style.display = "none";
                }
                div.style.display = "none";
                img.src = "../../Images/expand_blue.jpg";
                img.alt = "显示下级菜单";
            }
        }

        //清空页面
        function clearSelect(){
        document.getElementById("drop_area").value="";
        document.getElementById("drop_type").value="";
        document.getElementById("drop_color").value="";
        document.getElementById("drop_price").value="";
        document.getElementById("wending_month").value="";
        document.getElementById("dress_type").value="";
        document.getElementById("dress_level").value="";
        document.getElementById("dress_color").value="";
        document.getElementById("drop_dressprice").value="";
        document.getElementById("drop_weddingcolor").value="";
        document.getElementById("material_star").value="";
        document.getElementById("drop_desknum").value="";
        document.getElementById("hotel_specification").value = "";
        document.getElementById("file_remark").value = "";
        var checkarray = document.getElementsByTagName('input');
        for(var i in checkarray)
        {
        if(checkarray[i].type=="checkbox"){
        checkarray[i].checked = false;
        }
        }
          var els=document.getElementsByName("qstyle");
             for(var i=0;i<els.length;i++) {
             if(els[i].tagName.toLowerCase()=="input" && els[i].type=="checkbox") {
             //els[i].checked == false;
             document.getElementById("q" + els[i].value).checked = false;
             }
             }
         var els=document.getElementsByName("wstyle");
             for(var i=0;i<els.length;i++) {
             if(els[i].tagName.toLowerCase()=="input" && els[i].type=="checkbox") {
             //els[i].checked == false;
             document.getElementById("w" + els[i].value).checked = false;
             }
             }
          var els=document.getElementsByName("jstyle");
             for(var i=0;i<els.length;i++) {
             if(els[i].tagName.toLowerCase()=="input" && els[i].type=="checkbox") {
             //els[i].checked == false;
             document.getElementById("j" + els[i].value).checked = false;
             }
             }
        document.getElementById("name_hotel").value = "";
        document.getElementById("hotel_location").value = "";
        checkchange('xilai_show', 'show',  'img_show');
        checkchange('new_school', 'school',  'img_school');
        checkchange('wedding_made', 'made',  'img_made');
        checkchange('hotel_info', 'hotel',  'img_hotel');
        checkchange('my_xilai', 'xilai',  'img_xilai');
    }

    function addhotel() {
        var str = window.showModalDialog("../../Resources/HotelList/HotelFrame.htm", " ", "dialogWidth=800px;dialogHeight=400px");
        if (str != undefined) {
            document.getElementById("name_hotel").value = str;
        }
    }
    </script>
</head>
<body style="background-image:none">
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
            <Services>
                <asp:ServiceReference Path="PhotoServer.asmx" />
            </Services>
        </asp:ScriptManager>
       <%-- <table width="98%">
            <tr>
                <td align="right" style="width: 20%;">
                    标 题 ：
                </td>
                <td>
                    <asp:TextBox ID="Titel" runat="server"></asp:TextBox>
                </td>
                <td align="right" style="width: 20%">
                    图片状态 ：
                </td>
                <td>
                    <asp:DropDownList runat="server" Width="158px" ID="drop_State">
                        <asp:ListItem Text="全部" Value="-1"></asp:ListItem>
                        <asp:ListItem Text="待设定" Selected="True" Value="0"></asp:ListItem>
                        <asp:ListItem Text="已设定" Value="1"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 20%">
                    上传时间 ：
                </td>
                <td>
                    <input id="d12" runat="server" type="text" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'d13\')||\'%y-%M-%d\'}'})" />
                    <img onclick="WdatePicker({el:'d12'})" src="../../My97DatePicker/skin/datePicker.gif"
                        align="middle" width="16" height="22">
                </td>
                <td align="right" style="width: 20%">
                    到 ：
                </td>
                <td>
                    <input id="d13" runat="server" type="text" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'d12\');}',maxDate:'%y-%M-%d'})" />
                    <img onclick="WdatePicker({el:'d13'})" src="../../My97DatePicker/skin/datePicker.gif"
                        align="middle" width="16" height="22">
                </td>
            </tr>
            <tr>
                <td colspan="4" align="right">
                    <input type="button" id="btnSearch" onclick="Init()" value="查 询" runat="server" />
                </td>
            </tr>
        </table>--%>
        <div id="canvas">
            <%-- <ul id="myGallery">
            </ul>--%>
        </div>
        <br />
        <table width="98%">
            <tr>
                <td align="right" style="width: 20%;">
                    图片标题：
                </td>
                <td align="left">
                    <%--<asp:Label ID="file_name" runat="server"></asp:Label>--%>
                    <input type="text" id="filename" runat="server" />
                </td>
                 <td align="right">
                        上传者：
                    </td>
                    <td align="left">
                         <asp:Label ID="upUserName" runat="server"></asp:Label>
                    </td>
            </tr>
            <tr>
                <td align="right">
                    婚礼地区：
                </td>
                <td>
                    <asp:DropDownList ID="drop_area" Width="88px" runat="server">
                    </asp:DropDownList>
                </td>
                <td align="right">
                    庆典类型：
                </td>
                <td>
                    <asp:DropDownList ID="drop_type" Width="88px" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                 <td align="right">
                        资料星级：
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="material_star" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="right" style="width: 20%">
                    上传时间：
                </td>
                <td align="left">
                    <%--<input type="text" id="uptime" runat="server" readonly="readonly" />--%>
                    <asp:Label ID="updatetime" runat="server"></asp:Label>
                </td>
            </tr>
        </table>
        <br />
        <table id="fileattribute" width="98%">
            <tr>
                <td colspan="1">
                    <input type="checkbox" name="file_form" id="xilai_show" runat="server" onclick="javascript:checkchange('xilai_show', 'show',  'img_show')" />&nbsp;<asp:Label
                        runat="server" ID="labTitle" Text="喜来展示"></asp:Label>
                    &nbsp; <a href="javascript:expandcollapse('show', 'img_show');">
                        <img id="img_show" alt="点击显示/隐藏下级菜单" width="9px" border="0" src="../../Images/expand_blue.jpg" />
                    </a>
                </td>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
            <tbody id="show" style="display: none">
                <tr>
                    <td align="right" style="width: 20%;">
                        风 格：
                    </td>
                    <td colspan="3" id="addStyle" runat="server">
                        <%--<div id="addStyle"></div>--%>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 20%;">
                        色 彩：
                    </td>
                    <td>
                        <asp:DropDownList ID="drop_color" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="right" style="width: 20%;">
                        预 算：
                    </td>
                    <td>
                        <asp:DropDownList ID="drop_price" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 20%;">
                        月 份：
                    </td>
                    <td>
                        <asp:DropDownList ID="wending_month" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="right" style="width: 20%;">
                        酒店名称：
                    </td>
                    <td colspan="2">
                        <input id="name_hotel" runat="server" type="text" />&nbsp;&nbsp;<input type="button" id="hotelselect" runat="server" onclick="addhotel()" value="选择" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        礼服专区
                    </td>
                    <td>
                        &nbsp; <a href="javascript:expandcollapse('dress', 'img_dress');">
                            <img id="img_dress" alt="点击显示/隐藏下级菜单" width="9px" border="0" src="../../Images/expand_blue.jpg" />
                        </a>
                    </td>
                    <td colspan="2">
                        &nbsp;
                    </td>
                </tr>
            </tbody>
            <tbody id="dress" style="display: none">
                <tr>
                    <td align="right" style="width: 20%">
                        礼服类型：
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="dress_type" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="right" style="width: 20%">
                        礼服级别：
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="dress_level" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 20%">
                        礼服色彩：
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="dress_color" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="right" style="width: 20%">
                        礼服价格：
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="drop_dressprice" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
            </tbody>
            <tr>
                <td colspan="1">
                    <input type="checkbox" name="file_form" id="new_school" runat="server" onclick="javascript:checkchange('new_school', 'school',  'img_school')" />&nbsp;<asp:Label
                        runat="server" ID="lbl_school" Text="新人学堂"></asp:Label>
                    &nbsp; <a href="javascript:expandcollapse('school', 'img_school');">
                        <img id="img_school" alt="点击显示/隐藏下级菜单" width="9px" border="0" src="../../Images/expand_blue.jpg" />
                    </a>
                </td>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
            <tbody id="school" style="display: none">
                <tr>
                    <td align="right" style="width: 20%;">
                        婚礼知识：
                    </td>
                    <td align="left">
                        <input id="wedding_knowledge" runat="server" type="checkbox" />
                    </td>
                    <td align="right" style="width: 20%;">
                        新人问答：
                    </td>
                    <td align="left">
                        <input id="newer_aq" runat="server" type="checkbox" />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 20%;">
                        本地知识：
                    </td>
                    <td align="left" colspan="3">
                        <input id="local_knowledge" runat="server" type="checkbox" />
                    </td>
                </tr>
            </tbody>
            <tr>
                <td>
                    <input type="checkbox" name="file_form" id="wedding_made" runat="server" onclick="javascript:checkchange('wedding_made', 'made',  'img_made')" />&nbsp;<asp:Label
                        runat="server" ID="lbl_wm" Text="婚礼定制"></asp:Label>
                    &nbsp; <a href="javascript:expandcollapse('made', 'img_made');">
                        <img id="img_made" alt="点击显示/隐藏下级菜单" width="9px" border="0" src="../../Images/expand_blue.jpg" />
                    </a>
                </td>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
            <tbody id="made" style="display: none">
                <tr>
                    <td align="right" style="width: 20%;">
                        婚礼风格：
                    </td>
                    <td colspan="3" id="addweddingstyle" runat="server">
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 20%;">
                        婚礼色彩：
                    </td>
                    <td align="left" colspan="3">
                        <asp:DropDownList ID="drop_weddingcolor" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td colspan="4">
                        <div id="add" style="display: none;" align="center">
                            <div style="text-align: left; padding-top: 5px;">
                                &nbsp;&nbsp;<input type="button" value="添加项目" id="addproject" runat="server" onclick="AddProject()" />
                            </div>
                            <div id="Addtable" runat="server">
                            </div>
                        </div>
                    </td>
                </tr>
            </tbody>
            <tr>
                <td colspan="1">
                    <input type="checkbox" name="file_form" id="hotel_info" runat="server" onclick="javascript:checkchange('hotel_info', 'hotel',  'img_hotel')" />&nbsp;<asp:Label
                        runat="server" ID="lbl_hotel" Text="酒     店"></asp:Label>
                    &nbsp; <a href="javascript:expandcollapse('hotel', 'img_hotel');">
                        <img id="img_hotel" alt="点击显示/隐藏下级菜单" width="9px" border="0" src="../../Images/expand_blue.jpg" />
                    </a>
                </td>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
            <tbody id="hotel" style="display: none">
                <tr>
                    <td align="right" style="width: 20%;">
                        酒店风格：
                    </td>
                    <td id="addhotelstyle" colspan="3" runat="server">
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 20%;">
                        酒店桌数：
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="drop_desknum" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="right" style="width: 20%;">
                        大厅规格：
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="hotel_specification" Width="88px" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 20%;">
                        地理位置：
                    </td>
                    <td align="left" colspan="3">
                        <input id="hotel_location" style="width: 50%;" runat="server" type="text" />
                    </td>
                </tr>
            </tbody>
            <tr>
                <td colspan="1">
                    <input type="checkbox" name="file_form" id="my_xilai" runat="server" onclick="javascript:checkchange('my_xilai', 'xilai',  'img_xilai')" />&nbsp;<asp:Label
                        runat="server" ID="lbl_xilai" Text="我的喜来"></asp:Label>
                    &nbsp; <a href="javascript:expandcollapse('xilai', 'img_xilai');">
                        <img id="img_xilai" alt="点击显示/隐藏下级菜单" width="9px" border="0" src="../../Images/expand_blue.jpg" />
                    </a>
                </td>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
            <tbody id="xilai" style="display: none">
                <tr>
                    <td align="right" style="width: 20%;">
                        名片功能：
                    </td>
                    <td align="left">
                        <input id="card_function" runat="server" type="checkbox" />
                    </td>
                    <td align="right" style="width: 20%;">
                        资源类型：
                    </td>
                    <td align="left">
                        <input id="resource_type" runat="server" type="checkbox" />
                    </td>
                </tr>
            </tbody>
            <tr>
                <td align="right" style="width: 20%;">
                    产品备注：
                </td>
                <td align="left" colspan="2">
                    <asp:TextBox TextMode="MultiLine" Style="width: 100%;" ID="file_remark" runat="server"></asp:TextBox>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
             <%--<tr>
                <td align="right" style="width: 20%;">
                    项目备注：
                </td>
                <td align="left" colspan="2">
                    <asp:TextBox TextMode="MultiLine" Style="width: 100%;" ID="project_remark" runat="server"></asp:TextBox>
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>--%>
        </table>
    </div>
    <div style="text-align: center;">
        <input type="button" value="保 存" runat="server" onclick="AddData()" id="btnAdd" />&nbsp;&nbsp;
        <input type="button" value="清空选择 " runat="server" onclick="clearSelect()" id="btnClear" />&nbsp;&nbsp;
       <%-- <asp:Button ID="btn_return" runat="server" Text="返 回" onclick="btn_return_Click" />--%>
       <input id="retrun" type="button" runat="server" value="返 回" onserverclick="btn_return_Click" />
        <input id="btnclose" type="button" runat="server" style="display:none;" value="关闭" onclick="javascript:window.close();" />
        <div id="imagesrc">
        </div>
        <%--<asp:Button ID="getFile_Project" runat="server" style="display:none;" OnClick="getProjectData" />--%>
        <div style="display: none">
            <asp:HiddenField ID="hidPid" runat="server" />
            <asp:HiddenField ID="hidOtherPid" runat="server" />
            <asp:HiddenField ID="hidType" runat="server" Value="add" />
            <asp:HiddenField ID="hidProject" runat="server" Value="projectadd" />
            <asp:HiddenField ID="hidCount" runat="server" Value="0" />
            <asp:HiddenField ID="hidProjectType" runat="server" />
            <asp:HiddenField ID="hidProjectMaxPrice" runat="server" />
            <asp:HiddenField ID="hidProjectMinPrice" runat="server" />
            <asp:HiddenField ID="hidProjectIDList" runat="server" />
        </div>
    </div>
    </form>
</body>
</html>
